<?php

require_once "lib\Controller.php";
class admin extends Controller
{
    public function index(){
        session_start();
        if(empty($_COOKIE["token"])){
            exit("<script>location.href='index.php?c=user/login'</script>");
        }
        $date = $_SESSION[$_COOKIE["token"]];
        if($date['group'] != 1)
            exit("<script>location.href='index.php?c=user/index'</script>");
        $date['title'] = "后台";
        setcookie("token",$_COOKIE["token"],time()+120);
        $this->render("index",$date);
    }
}